<?php
class RepartitionPage extends CI_Controller{
	
	public function index(){
		echo "hello";
	}
	
	public function repartition($idGroupe){
		
		require_once "ajax.php";
		$ajax = ajax();
		
		$query=$this->doctrine->em->createQuery("SELECT p FROM Page p JOIN p.idmodule m JOIN m.idgroupe g WHERE g.id=".$idGroupe." ORDER BY p.libelle");
		$pages=$query->getResult();
		
		$dataPage="";
		
		foreach ($pages as $page){
			$controlleur=$page->getControlleur();
			$libelle=$page->getLibelle();
			
			$dataPage.="<a id='module".$controlleur."'><div class='module'>".$libelle."</div></a>";
			$dataPage.="<div id='".$controlleur."' class='gestionModule'></div>";
			$ajax->click("module".$controlleur,$ajax->$controlleur=$ajax->call($controlleur."/gestion"));
		}
		$this->load->view('vGestion',array("dataPage"=>$dataPage,"dataAjax"=>$ajax));
	}
}